import { defineConfig } from 'vite'
import { resolve } from 'path'
import uni from "@dcloudio/vite-plugin-uni";

// https://vitejs.dev/config/
const fs = require('fs')
const path = require('path')
export default defineConfig({
  plugins: [
    uni(),
    // basicSsl(),
  ],
  resolve: {
    alias: {
      '@': resolve(__dirname, 'src'), // 设置 `@` 指向 `src` 目录
    }
  },
  
  server: {
    port: 8080, // 设置服务启动端口号
    host: '0.0.0.0',
    open: true, // 设置服务启动时是否自动打开浏览器
    cors: true, // 允许跨域
    // 设置代理，根据我们项目实际情况配置
    proxy: {
      '/api': {
        target: 'http://47.107.225.95:9088/', //47.107.225.95:9088/app/api/G/user-heibai/v1/UserInfo/151879
        // target: 'https://api.ysjcp.com', //47.107.225.95:9088/app/api/G/user-heibai/v1/UserInfo/151879
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/, '')
      }
    },
  },
})